home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / bbs / cddk9606.zip / HEADERS.ARJ / TYPES.INT < prev    next >
Text File  |  1996-06-14  |  5KB  |  191 lines

  1.  
  2. { ───────────────────────────────────────────────────────────────────────── }
  3. {  TYPES: Predefined variable types for SCRIPTS.PAS                         }
  4. {  Copyright 1996 David Pinch ∙ All Rights Reserved Worldwide               }
  5. { ───────────────────────────────────────────────────────────────────────── }
  6.  
  7. UNIT Types;
  8.  
  9. {$B-} { . . . . . . . . . . . . . . . . . . . . Shortcut boolean evaluation }
  10. {$F+} { . . . . . . . . . . . . . . . . . . . .  Force far calls for safety }
  11. {$I-} { . . . . . . . . . . . . . . . . . . . Disable input/output checking }
  12. {$O+} { . . . . . . . . . . . . . . . . . . Allow this unit to be overlayed }
  13. {$Q-} { . . . . . . . . . . . . . .  Do not generate overflow-checking code }
  14. {$R-} { . . . . . . . . . . . . . . . . Do not generate range-checking code }
  15. {$S-} { . . . . . . . . . . . . . . . . Do not generate stack-checking code }
  16. {$X+} { . . . . . . . . . . . Extended syntax for pChars and function calls }
  17.  
  18. INTERFACE
  19.  
  20. USES
  21.   Scripts;
  22.  
  23. TYPE
  24.  
  25.   VarBoolean = OBJECT(tVariable)
  26.     BooStrs : ARRAY[False..True] OF STRING[30];
  27.     CONSTRUCTOR Init(p:pChar; Addr:Pointer);
  28.     PROCEDURE Assign(p:pChar); VIRTUAL;
  29.     FUNCTION  Obtain:STRING; VIRTUAL;
  30.     END;
  31.  
  32.   pVarBoolean = ^VarBoolean;
  33.  
  34.   VarByte = OBJECT(tVariable)
  35.     PROCEDURE Assign(p:pChar); VIRTUAL;
  36.     FUNCTION Obtain:STRING; VIRTUAL;
  37.     END;
  38.  
  39.   pVarByte = ^VarByte;
  40.  
  41.   VarChar = OBJECT(tVariable)
  42.     PROCEDURE Assign(p:pChar); VIRTUAL;
  43.     FUNCTION  Obtain:STRING; VIRTUAL;
  44.     END;
  45.  
  46.   pVarChar = ^VarChar;
  47.  
  48.   VarDynamic = OBJECT(tVariable)
  49.     DoNotDispose : Boolean;
  50.     PROCEDURE Assign(p:pChar); VIRTUAL;
  51.     FUNCTION  Obtain:STRING; VIRTUAL;
  52.     DESTRUCTOR Done; VIRTUAL;
  53.     END;
  54.  
  55.   pVarDynamic = ^VarDynamic;
  56.  
  57.   VarLongInt = OBJECT(tVariable)
  58.     PROCEDURE Assign(p:pChar); VIRTUAL;
  59.     FUNCTION  Obtain:STRING; VIRTUAL;
  60.     END;
  61.  
  62.   pVarLongInt = ^VarLongInt;
  63.  
  64.   VarTPString = OBJECT(tVariable)
  65.     MaxLen : Byte;
  66.     CONSTRUCTOR Init(p:pChar; Addr:Pointer; Sz:Byte);
  67.     PROCEDURE Assign(p:pChar); VIRTUAL;
  68.     FUNCTION Obtain:STRING; VIRTUAL;
  69.     END;
  70.  
  71.   pVarTPString = ^VarTPString;
  72.  
  73.   VarString = OBJECT(tVariable)
  74.     MaxLen : Word;
  75.     CONSTRUCTOR Init(p:pChar; Addr:Pointer; Sz:Byte);
  76.     PROCEDURE Assign(p:pChar); VIRTUAL;
  77.     FUNCTION  Obtain:STRING; VIRTUAL;
  78.     END;
  79.  
  80.   pVarString = ^VarString;
  81.  
  82.   VarWord = OBJECT(tVariable)
  83.     PROCEDURE Assign(p:pChar); VIRTUAL;
  84.     FUNCTION  Obtain:STRING; VIRTUAL;
  85.     END;
  86.  
  87.   pVarWord = ^VarWord;
  88.  
  89.   VarDirectory = OBJECT(VarDynamic)
  90.     PROCEDURE Assign(p:pChar); VIRTUAL;
  91.     DESTRUCTOR Done; VIRTUAL;
  92.     END;
  93.  
  94.   pVarDirectory = ^VarDirectory;
  95.  
  96.  
  97. {#Start}
  98.  
  99. PROCEDURE RegisterBoolean(Name:pChar; Addr:Pointer);
  100.   {
  101.   PURPOSE  : Registers a boolean variable with the script interpreter.
  102.  
  103.   EXAMPLE  : RegisterBoolean('DirectVideo',@CRT.DirectVideo);
  104.   }
  105.  
  106.  
  107. PROCEDURE RegisterByte(Name:pChar; Addr:Pointer);
  108.   {
  109.   PURPOSE  : Registers a byte with the script interpreter.
  110.  
  111.   EXAMPLE  : RegisterByte('TextAttr',@CRT.TextAttr);
  112.   }
  113.  
  114.  
  115. PROCEDURE RegisterChar(Name:pChar; Addr:Pointer);
  116.   {
  117.   PURPOSE  : Registers a character with the script interpeter.
  118.  
  119.   EXAMPLE  : RegisterChar('YourChar',@YourChar);
  120.   }
  121.  
  122.  
  123. PROCEDURE RegisterDirectory(Name:pChar; Addr:Pointer);
  124.   {
  125.   Registers a pChar holding a directory name.  The object makes sure that
  126.   the string always contains a terminating slash character (/).  The string
  127.   is automatically disposed upon termination of the door.
  128.   }
  129.  
  130.  
  131. PROCEDURE RegisterDynamic(Name:pChar; Addr:Pointer);
  132.   {
  133.   PURPOSE  : Registers a pChar with the script interpreter.  The string
  134.              is automatically disposed with StrDispose upon termination
  135.              of the program.
  136.  
  137.   SEE ALSO : RegisterDynamicNoDipose
  138.   }
  139.  
  140. PROCEDURE RegisterDynamicNoDispose(Name:pChar; Addr:Pointer);
  141.   {
  142.   PURPOSE  : Registers a pChar with the script interpreter.  The
  143.              string is not disposed by the interpreter upon termination
  144.              of the program.  You must check for a non-NIL value and
  145.              call StrDispose yourself!
  146.  
  147.   SEE ALSO : RegisterDynamic
  148.   }
  149.  
  150.  
  151. PROCEDURE RegisterLongInt(Name:pChar; Addr:Pointer);
  152.   {
  153.   PURPOSE  : Registers a LongInt with the script interpreter.
  154.  
  155.   EXAMPLE  : RegisterLongInt('RandSeed',@System.RandSeed);
  156.   }
  157.  
  158.  
  159. PROCEDURE RegisterString(Name:pChar; Addr:Pointer; Len:Byte);
  160.   {
  161.   PURPOSE  : Registers a null-terminated string with the script
  162.              interpreter.  The interpreter is free to assign strings
  163.              of any length to the variable, up to the specified
  164.              maximum length.
  165.   }
  166.  
  167.  
  168. PROCEDURE RegisterTPString(Name:pChar; Addr:Pointer; Len:Byte);
  169.   {
  170.   PURPOSE  : Registers a Turbo Pascal string with the script interpreter.
  171.              You must specify the maximum length of the string (not the
  172.              current length or memory size of the string!).
  173.  
  174.   EXAMPLE  : RegisterTPString('YourString',@YourString,255);
  175.   }
  176.  
  177.  
  178. PROCEDURE RegisterWord(Name:pChar; Addr:Pointer);
  179.   {
  180.   PURPOSE  : Registers a Word with the script interpreter.
  181.  
  182.   EXAMPLE  : RegisterWord('LastMode',@CRT.LastMode);
  183.   }
  184.  
  185.  
  186. IMPLEMENTATION
  187.  
  188. { The source code is available upon registration. }
  189.  
  190. END.
  191.